package com.muqiuhan.hanmq.message

import upickle.default.*

/** Message protocol format:
  * consumer's subscription registration message:
  *     { type: 0, extend: ["queue_name1","queue_name1"] }
  * General messages from the producer:
  *     { type: 1, content: "message content", extend: "routing key" } */
case class Message(
    typ: Int,
    content: String,

    /** If type is 0, extend is the queueName from the consumer, specifying which queue to connect to.
      * If type is 1, extend is the routingKey from the producer */
    extend: String,

    /** The time the message was sent */
    date: String
) derives ReadWriter
